package dblayer;

import java.sql.ResultSet;
import java.sql.Statement;

public class GetMax {

	public GetMax(){
		
	}
	
	public static int getMaxID(String query){
		ResultSet result;
		int id = -1;
		
		try{
			Statement stmt = DBConnection.getInstance().getDBcon().createStatement();
			result = stmt.executeQuery(query);
			
			if(result.next()){
				id = result.getInt(1);
			}
		}
		catch(Exception e){
			System.out.println("Error in getting max index");
		}
		
		return id;
	}
}
